import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '@/views/login/login.vue'
import index from '@/views/index/index.vue'
import detail from '@/views/detail/detail.vue'
import order from '@/views/order/order.vue'
import search from '@/views/search/search.vue'
import searchList from '@/views/searchList/searchList.vue'
import pay from '@/views/pay/pay.vue'
import { NavBar } from 'vant'
import cart from '@/views/index/cart.vue'
import user from '@/views/index/user.vue'
import home from '@/views/index/Home.vue'
import category from '@/views/index/category.vue'

Vue.use(NavBar)
Vue.use(VueRouter)

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes: [
    { path: '/login', component: login },
    {
      path: '/',
      component: index,
      children: [
        { path: '/home', component: home },
        { path: '/category', component: category },
        { path: '/cart', component: cart },
        { path: '/user', component: user }
      ]
    },
    { path: '/', component: index },
    { path: '/detail', component: detail },
    { path: '/order', component: order },
    { path: '/pay', component: pay },
    { path: '/search', component: search },
    { path: '/searchList', component: searchList }
  ]
})

export default router
